package cn.jingyuan.owl.utils.core.thread.threadlocal;

/**
 * 带有 Name 标识的 {@link ThreadLocal}，调用 toString 返回 name
 *
 * @param <T> 值类型
 */
public class NamedThreadLocal<T> extends ThreadLocal<T> {

    private final String name;

    /**
     * 构造
     *
     * @param name 名字
     */
    public NamedThreadLocal(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return this.name;
    }

}
